<template>
	<view :class="{'bg-black3':!vdshow,'bg-black':vdshow}">
		<u-toast ref="uToast" />
		<template v-if="vdshow">
			<!-- #ifdef MP-WEIXIN || MP-KUAISHOU -->
			<m-video class="mvideopage" ref="mvideo" :video-list="videoList" :orgvideoList="clonevideoList" :startNumber="startNumber"
				:my_like_list="my_like_list" :showtype="2" :ceshicishu="ceshicishu" :buy_episodes_list="buy_episodes_list" :objectFit="objectFit"
				@clickFeedback="feedbackFn" @clickEpisode="clickEpisodeFn" @updateBuyList="updateBuyList" @diyerror="diyerror"  @expireRefresh="expireRefresh"
				@expiresVideo="expiresVideoFn" @curInfo="curInfoFn">
				<!-- 此处为用户完全自定义 data 中的数据为当前渲染的数据 -->
				<!-- <template v-slot="{listitem}">
				  <text class="video-layer text-white position-absolute top-10 left-10" style="z-index: 999999;"> {{listitem.id}} </text>
				</template> -->
			</m-video>
			<!-- #endif -->
			<!-- #ifdef MP-TOUTIAO -->
			<dy-video class="mvideopage" ref="mvideo"  :video-list="videoList" :orgvideoList="clonevideoList" :startNumber="startNumber"
				:my_like_list="my_like_list" :showtype="2" :buy_episodes_list="buy_episodes_list" :objectFit="objectFit"
				@clickFeedback="feedbackFn" @clickEpisode="clickEpisodeFn" @updateBuyList="updateBuyList" @diyerror="diyerror"
				@continuePlay="continuePlay"
				@bofangzhong="bofangzhong"
				@curInfo="curInfoFn">  
				<!-- 此处为用户完全自定义 data 中的数据为当前渲染的数据 -->
				<!-- <template v-slot="{listitem}">
				  <text class="video-layer text-white position-absolute top-10 left-10" style="z-index: 999999;"> {{listitem.id}} </text>
				</template> -->
			</dy-video>
			<!-- #endif -->
		</template>
		<view v-else-if="loading" class="d-flex a-center j-center"
			:style="{width:windowWidth+'px',height:videoPageHeight+'px'}">
			<view class="d-flex flex-column loadingMain a-center j-center bg-black rounded30">
				<u-loading-icon mode="semicircle" vertical size="30" text="视频加载中" color="#FAA55D"></u-loading-icon>
			</view>
		</view>
		<view v-else class="d-flex a-center j-center" :style="{width:windowWidth+'px',height:videoPageHeight+'px'}">
			<text class="d-flex text-light font-md3">该剧集即将上线，敬请期待！{{errorcode}}</text>
		</view>
		<!-- 反馈 -->
		<u-popup :show="showFeedback" mode="bottom" closeOnClickOverlay bgColor="transparent" @open="showFeedback=true"
			@close="showFeedback=false">
			<vdfk @closeFk="showFeedback=false"></vdfk>
		</u-popup>
		<!-- 选集 -->
		<u-popup :show="showEpisodesList" mode="bottom" closeOnClickOverlay bgColor="transparent"
			@open="openEpisodesList" @close="showEpisodesList=false">
			<vdlist :buy_episodes_list="buy_episodes_list" :curInfo="curInfo" :listAll="eList.length?eList:videoList"
				:init="initEpisodesList" @closevl="closeEpisodesList"> </vdlist>
		</u-popup>
	</view>
</template>

<script>

	import {
		mapState
	} from 'vuex';
	// #ifdef MP-WEIXIN || MP-KUAISHOU
	import mVideo from '@/components/mvideo/mvideo';
	// #endif
	// #ifdef MP-TOUTIAO
	import dyVideo from '@/components/mvideo/dyvideo';
	// #endif
	import vdfk from '@/components/mvideo/wxvideofk.vue';
	import vdlist from '@/components/mvideo/videolist.vue';
	import config from "@/utils/config.js"
	import interfaces from '@/utils/interfaces.js';
	import tools from '@/utils/tools.js';
	export default {
		components: {
			// #ifdef MP-WEIXIN || MP-KUAISHOU
			mVideo,
			// #endif
			// #ifdef MP-TOUTIAO
			dyVideo,
			// #endif
			vdfk,
			vdlist
		},
		computed: {
			...mapState({
				userInfo: state => state.user.userInfo,
				openid: state => state.user.openid,
				statusBarHeight: state => state.layout.statusBarHeight,
				windowWidth: state => state.layout.windowWidth,
				videoPageHeight: state => state.layout.videoPageHeight,
				platform: state => state.layout.platform,
				xBarHeight: state => state.layout.xBarHeight //苹果手机安全区高度
			})
		},
		data() {
			return {
				onHide_index:0,
				fastswiper:false,
				isContinue:false,
				diyonHide:false,
				recordNum:0,
				ceshicishu:1,
				errorcode:"1000",
				objectFit: 'contain', //contain：包含，fill：填充，cover：覆盖
				initEpisodesList: 0, // Date.now()
				startNumber: 1,
				showFeedback: false, //是否显示反馈弹窗
				showEpisodesList: false, //是否显示剧集弹窗
				isShow: true,
				loading: true,
				videoCurInfo: {}, //当前视频信息
				video_info: {},
				extraData: {},
				curInfo: {},
				eList: [],
				buy_episodes_list: [],
				my_like_list: [],
				sharevdoc: '', //当前是否有分享的VDOC
				pageindex: 0, //当前加载页码
				vdshow: false, //等数据加载好后再加载控件
				videoList: [], //播放列表
				clonevideoList:[],
				newVideoList: [], //过期之后新的播放列表
				current_index: 0, // 这个参数可以控制从第几个视频开始播放（可以从onLoad动态修改这个参数）默认从0条开始
			};
		},
		created() {
			console.warn('createdcreatedcreatedcreatedcreated');
			uni.setNavigationBarTitle({
				title: '第一集'
			})
		},
		watch: {},
		onShareAppMessage(res) {
			console.log(122,this.videoCurInfo) 
				try {
					if (typeof this.videoCurInfo == 'object' && this.videoCurInfo != null) {
						console.log(this.videoCurInfo);
						console.log('/pages/videopage/videopage?pid=' + this.videoCurInfo.playlet_id + '&peid=' + this
							.videoCurInfo.playlet_number);
						return {
							title: this.videoCurInfo.name + (this.videoCurInfo.playlet_number ? ('  第' + this.videoCurInfo
								.playlet_number + '集') : ''),
							
							path: '/pages/videopage/videopage?pid=' + this.videoCurInfo.playlet_id + '&peid=' + this
								.videoCurInfo.playlet_number
						}
					}
				} catch (e) {}
			
		},
		// created(){
		// 	this.$store.commit('mut_initLayout');
		// },
		onLoad(options) {
			console.log(166,options)
			// 测试
		    let that = this;
			this.$store.commit('mut_initLayout');
			this.check_video_objectFit();
			console.log(options);
			if (options.video_info) {
				let {
					video_info
				} = options;
				if (!(this.openid || uni.getStorageSync(config.openid))) {
					this.loading = false;
					uni.showToast({
						title: "出错！缺少openid",
						duration: 3000,
						icon: "none",
						mask: true
					});
					return
				}
				if (video_info) {
					this.video_info = JSON.parse(decodeURIComponent(video_info));
					console.log(this.video_info);
					this.$store.commit('mut_videoInfo', this.video_info);
					let playlet_id = this.video_info.playlet_id || "0";
					this.getVideoLike(that, playlet_id);
					console.log(playlet_id);
					console.log(this.video_info);
					tools.get_user_info_by_serve(that, () => {});
					that.getvdlist();
				} else {
					console.log('====video_info为空');
					that.loading = false;
				}
			} else {
				let optionsObj = {};
				optionsObj = JSON.stringify(options);
				that.loadInit(options, optionsObj);
			}
			// 保持屏幕常亮
			uni.setKeepScreenOn({
				keepScreenOn: true
			});
			// #ifdef MP-TOUTIAO
			if (this.platform == 'ios') {
				//ios录屏
				tt.onUserScreenRecord((res) => {
					if (res.state === "start") {
						// 开始录屏
						that.isShow = false; //页面遮挡
						uni.showToast({
							title: "抱歉，禁止录屏",
							duration: 2000,
							icon: "none",
							mask: true
						});
					} else if (res.state === "stop") {
						// 取消录屏
						that.isShow = true; //页面不遮挡
					}
				});
			} else {
				//安卓禁止录屏
				tt.disableUserScreenRecord();
			}
			tt.onUserCaptureScreen((res) => {
				console.log('截屏', res)
				that.isShow = false; //页面遮挡
				uni.showToast({
					title: "抱歉，禁止截屏",
					duration: 2000,
					icon: "none",
					mask: true
				});
			});
			// #endif
			// #ifdef MP-WEIXIN || MP-KUAISHOU
			if (this.platform == 'ios') {
				//查询用户是否在录屏
				if (wx.getScreenRecordingState) {
					wx.getScreenRecordingState({
						success: res => {
							if (res.state != 'off') {
								that.isShow = false; //页面遮挡
								uni.showToast({
									title: "抱歉，禁止录屏",
									duration: 2000,
									icon: "none",
									mask: true
								});
							} else {
								that.isShow = true; //页面不遮挡
							}
						}
					})
				}
				// 监听用户录屏事件
				if (wx.onScreenRecordingStateChanged) {
					wx.onScreenRecordingStateChanged(res => {
						if (res.state == 'start') {
							that.isShow = false; //页面遮挡
							uni.showToast({
								title: "抱歉，禁止录屏",
								duration: 2000,
								icon: "none",
								mask: true
							});
						} else {
							that.isShow = true; //页面不遮挡
						}
					})
				}
			} else {
				wx.setVisualEffectOnCapture({
					visualEffect: 'hidden'
				});
			}
			// #endif
		},
		onShow(){
			console.log(402)
			if(this.diyonHide){
				if(this.fastswiper){
					console.log('fastswiper',this.onHide_index)
					this.$refs.mvideo.initSwiperData();
					this.fastswiper = false;
					this.diyonHide = false;
					return
				}
				console.log(273,this.isContinue)
				if(this.isContinue){
					console.log(282282,'isContinue')
					this.$refs.mvideo.clickPlay();
					this.diyonHide = false;
				}
			}
		},
		onHide(){
			console.log(270)
			this.diyonHide = true
		},
		destroyed() {
			let that = this;
			console.warn('destroyeddestroyed===============');
			// #ifdef MP-TOUTIAO
			tt.offUserCaptureScreen();
			tt.offUserScreenRecord();
			// #endif
			// #ifdef MP-WEIXIN || MP-KUAISHOU
			wx.offUserCaptureScreen();
			wx.offScreenRecordingStateChanged();
			// #endif
			if(this.$refs.mVideo){
				this.$refs.mVideo.stopVideo();
				setTimeout(()=>{
					that.vdshow = false;
				},0)
			}
			
		},
		methods: {
			bofangzhong(i){
				this.fastswiper = true;
				console.log(315,onHide_index)
				this.onHide_index = i
			},
			continuePlay(torf){
				this.isContinue = torf;
			},
			diyerror(e){
				console.log(286,e)
				let errorNum = uni.getStorageSync('errorNum') ? uni.getStorageSync('errorNum') : 0 ;
				let errorTime = uni.getStorageSync('errorTime') ? uni.getStorageSync('errorTime') : 0 ;
						
				if(Number(errorNum)>=3 ){
					console.log("大于三次")
					if( errorTime == 0 ){
							uni.setStorageSync("errorTime", new Date().getTime())
							return uni.showToast({title: '视频播放出错，请重启小程序!',duration: 3000,icon: "none"});
					}
					if(errorTime != 0 && !(errorTime + 60 * 3 * 1000 < new Date().getTime()) ){
							return uni.showToast({title: '视频播放出错，请重启小程序!',duration: 3000,icon: "none"});
					}
					console.log(157,errorTime ,errorTime != 0,errorTime + 60 * 0.5 * 1000 < new Date().getTime())
					if(errorTime != 0 && errorTime + 60 * 3 * 1000 < new Date().getTime() ){
						uni.setStorageSync("errorNum" , 0)
						uni.setStorageSync("errorTime" , 0)
					}
				}
				errorNum = uni.getStorageSync('errorNum') ? uni.getStorageSync('errorNum') : 0 ;
				uni.setStorageSync("errorNum", errorNum + 1 )
				if(e){
					this.recordNum = e
				}
				this.getvdlist()
				console.log(287)
			},
			
			expireRefresh(e){
				console.log(286,e)
				let errorNum2 = uni.getStorageSync('errorNum2') ? uni.getStorageSync('errorNum2') : 0 ;
				let errorTime2 = uni.getStorageSync('errorTime2') ? uni.getStorageSync('errorTime2') : 0 ;
						
				if(Number(errorNum2)>=3 ){
					console.log("大于三次")
					if( errorTime2 == 0 ){
							uni.setStorageSync("errorTime2", new Date().getTime())
							return uni.showToast({title: '视频播放出错，请重启小程序!',duration: 3000,icon: "none"});
					}
					if(errorTime2 != 0 && !(errorTime2 + 60 * 1 * 1000 < new Date().getTime()) ){
							return uni.showToast({title: '视频播放出错，请重启小程序!',duration: 3000,icon: "none"});
					}
					console.log(157,errorTime2 ,errorTime2 != 0,errorTime2 + 60 * 1 * 1000 < new Date().getTime())
					if(errorTime2 != 0 && errorTime2 + 60 * 1 * 1000 < new Date().getTime() ){
						uni.setStorageSync("errorNum2" , 0)
						uni.setStorageSync("errorTime2" , 0)
					}
				}
				errorNum2 = uni.getStorageSync('errorNum2') ? uni.getStorageSync('errorNum2') : 0 ;
				uni.setStorageSync("errorNum2", errorNum2 + 1 )
				if(e){
					this.recordNum = e
				}
				this.getvdlist()
			
			},
			
			check_video_objectFit() {
				try {
					if (this.windowWidth - (this.videoPageHeight - this.xBarHeight - 50) * 0.5625 <= 50) {
						this.objectFit = 'fill';
					} else {
						this.objectFit = 'contain';
					}
				} catch (e) {}
			},
			getVideoLike(that, playlet_id) {
		
				//获取点赞列表
				tools.getVideoListStatus(that, playlet_id, (res) => {
					if (res.code === config.SUCCESS) {
						console.warn('=====点赞列表=====');
						console.log(res.content);
						that.my_like_list = res.content;
						return;
					}
					console.warn('=====点赞列表为空=====');
					that.my_like_list = [];
				})
			},
			curInfoFn(info) {
				this.videoCurInfo = info;
			},
			openEpisodesList() {
				let that = this;
		
				try{
					console.log(314,this.userInfo)
					if(this.userInfo.ios_payment==0){
						
						let nowTime = Date.now(),endTime = uni.getStorageSync('countdownTime');
						console.log(318,nowTime,endTime)
						if(endTime){
							if(nowTime>=endTime){
								tools.get_user_info_by_serve(that, () => {
									console.warn('重新获取用户信息===================================');
									if(typeof that.videoCurInfo == 'object' && that.videoCurInfo!=null){
										if(JSON.stringify(that.videoCurInfo)!='{}'){
											that.reloadlist(that.videoCurInfo.playlet_id);
											this.initEpisodesList = Date.now();
										}
									}
								});
							}
						}
					}
				}catch(e){
				}
				this.initEpisodesList = Date.now();
			},
			loadInit(options, optionsObj) {
				let that = this;
				let _data = {};
				_data['optionsObj'] = optionsObj;
				if (this.platform) _data['platform_type'] = this.platform;
				if (typeof options == 'object' && options != null) {
					Object.keys(options).map((key) => {
						if (key && key != 'ad_id') {
							if (key == 'promotionid' || key == 'promotion_id') {
								_data['promotion_id'] = options[key];
							} else if (key == 'clickid' || key == 'click_id') {
								_data['click_id'] = options[key];
							} else if (typeof options[key] != 'object') {
								_data[key] = options[key];
							} 
							// else if (key == 'query' && typeof query == 'object' && query != null) {
							// 	let query = options[key];
							// 	Object.keys(query).map((k) => {
							// 		if (k && typeof query[k] != 'object') {
							// 			_data[k] = query[k];
							// 		}
							// 	})
							// }
						}
					})
				}
				let pid = _data['pid'],
					peid = _data['peid'],
					spread_id = _data['spread_id'];
				wx.login({
					success(res) {
						if (res.code) {
							console.log(364,res)
							_data['login_code'] = res.code;
							console.log(res);
							console.log({
								url: interfaces.get_openid,
								method: "POST",
								data: _data
							});
							//发起网络请求
							that.request({
								url: interfaces.get_openid,
								method: "POST",
								data: _data,
								success: (r) => {
										console.log(378,r)
									console.warn('登录success！', r)
									console.warn(_data);
									that.$store.commit("mut_openid", r.content.openid);
									that.$store.commit("mut_spread_id", spread_id);
									that.$nextTick(() => {
										console.log(r.content);
										uni.setStorageSync(config.coin_name, r.content
											.coin_name);
										uni.setStorageSync(config.session_key, r.content
											.session_key);
									})
									if (!r.content.openid) {
										that.loading = false;
										uni.showToast({
											title: "出错！缺少openid",
											duration: 3000,
											icon: "none",
											mask: true
										});
										return
									}
									try {
										tools.get_user_info_by_serve(that, () => {});
										that.getVideoLike(that, pid);
									} catch (e) {}
									that.getvdlist(pid, peid);
								}
							})
						} else {
							uni.showToast({
								title: '登录失败！' + res.errMsg,
								duration: 3000,
								icon: "none",
								mask: false
							});
						}
					}
				})
			},
			closeEpisodesList(data) {  //关闭选集
				
				this.showEpisodesList = false;
				if (typeof data == 'object' && data != null) {
					console.log(424,data);
					if (typeof data.playlet_number == 'number') { //选集后关闭
						console.warn('===切换剧集===');
						this.jump_episodes(data.playlet_number);
					}
				}
			},
			jump_episodes(playlet_number) { 
				console.warn('跳第' + playlet_number + '集');
				this.$refs.mvideo.scrollVideo(playlet_number, true, true);
			},
			clickEpisodeFn(data) { //显示选集弹出窗
				console.log('clickEpisodeFn433',data);
				this.showEpisodesList = true; 
				this.curInfo = data;
			},
			feedbackFn(data) {
				console.log('feedbackFnfeedbackFn');
				this.showFeedback = true;
			},
			expiresVideoFn(info) {
				console.log(info);
				console.warn('过期去请求最新剧集数据');
				this.video_info = info;
				this.getvdlist();
			},
			getvdlist(pid, peid) {
				
				this.vdshow = false;
				this.errorcode = "400"
				let playlet_id, name = '';
				let that = this;
				// 有视频信息
				if (JSON.stringify(this.video_info) != '{}') {
					playlet_id = this.video_info.playlet_id || "0";
					name = this.video_info.name || "";
					let playlet_number = this.video_info.playlet_number || 1;
					this.startNumber = playlet_number;
				} else {
					playlet_id = pid;
					this.startNumber = peid;
				}
				that.request({
					url: interfaces.episodes_list,
					method: config.post,
					data: {
						playlet_id: playlet_id
					},
					success: (res) => {
						if (res.code === config.SUCCESS) {
							console.warn('===获取视频列表成功===');
							
							if (Array.isArray(res.content)) {
								let clonearr = JSON.parse(JSON.stringify(res.content))
								console.log(479,clonearr);
								let episodeLen = res.content.length;
								if (episodeLen) {
									let tempArray = [];
									for (let i = 0; i < episodeLen; i++) {
										// #ifdef MP-TOUTIAO
										if (res.content[i].album_id && res.content[i].dy_episodes_id) {
											res.content[i]['id'] = i + 1;
											res.content[i]['last_episode_number'] = episodeLen;
											tempArray.push(res.content[i])
										}
										// #endif
										// #ifdef MP-WEIXIN || MP-KUAISHOU
										if (res.content[i].wx_original_url) {
											res.content[i]['expiresTime'] = this.getTime(res.content[i].wx_original_url);
											res.content[i]['id'] = i + 1;
											res.content[i]['last_episode_number'] = episodeLen;
											tempArray.push(res.content[i])
										}
										// #endif
									}
									// console.log(tempArray);
									// tempArray[2].expiresTime = 1698650080000;
									// tempArray[2].episodes_list.wx_original_url = "https://1500026055.vod-qcloud.com/a29c5129vodtranssh1500026055/eace59003270835011383445396/v.f1453329.m3u8?t=64dd8280&us=653f7edd035e2fe3d34e9869&sign=13aee3d5597ef512903cf73fa62c5cd6"
									if (!tempArray.length) {
										that.loading = false;
										this.vdshow = false;
										this.errorcode = "500"
										return;
									}
									tools.buy_episodes_list(that, playlet_id, (res) => {
										console.log(541,res)
										if (Array.isArray(res.content)) {
											if (res.content.length) {
												(res.content).sort((a, b) => a - b);
												that.buy_episodes_list = res.content;
												for (var i = 0; i < that.buy_episodes_list
													.length; i++) {
													if (typeof that.buy_episodes_list[i] =='number') {
														tempArray[that.buy_episodes_list[i] - 1].pay_staus = 1;
													}
												}
												console.log('====购买剧集的id===');
												console.log(that.buy_episodes_list);
											}
										}
										if (JSON.stringify(that.userInfo) != "{}") {
											that.vdshow = true; //数据加载到了再加载控件
											that.loading = false;
											// console.log(5555,that.ceshicishu)
											// if(that.ceshicishu == 1){
											// 	console.log(556,"进来了吗?")
											// 	tempArray[3].wx_original_url='https://1500026055.vod-qcloud.com/a29c5129vodtranssh1500026055/ed3640073270835011383556994/v.f1453329.m3u8?t=65522c1f&us=65520ffe60c54fbeca67b667&sign=e351cf888a70a4ceec1bf046295f9851'
											// 	that.ceshicishu = 2
											// }
										
											that.videoList = tempArray;
											that.clonevideoList = clonearr;
											if(that.recordNum !=0 ){
												setTimeout(()=>{
													that.closeEpisodesList(tempArray[that.recordNum - 1])
												},500)
											}
										} else {
											tools.get_user_info_by_serve(that, () => {
												that.vdshow = true; //数据加载到了再加载控件
												that.loading = false;
												
												that.videoList = tempArray;
												that.clonevideoList = clonearr;
												if(that.recordNum !=0 ){
													setTimeout(()=>{
														that.closeEpisodesList(tempArray[that.recordNum - 1])
													},500)
												}
											})
										}
									})
									return
								}
								that.loading = false;
								this.vdshow = false;
								this.errorcode = "600"
								console.warn('===视频列表为空===');
							} else {
								this.loading = false;
								this.vdshow = false;
								this.errorcode = "700"
								uni.showToast({
									title: '获取视频列表出错！',
									duration: 3000,
									icon: "none",
									mask: false
								});
							}
						} else {
							this.loading = false;
							if (res.message && typeof res.message == 'string') {
								uni.showToast({
									title: res.message,
									duration: 3000,
									icon: "none",
									mask: false
								});
							}
						}
					},
					fail: (err) => {
						this.loading = false;
					}
				})
			},
			reloadlist(playlet_id){
				let that = this;
				that.request({
					url: interfaces.episodes_list,
					method: config.post,
					data: {playlet_id},
					success: (res) => {
						console.log(568,res)
						if (res.code === config.SUCCESS) {
							if (Array.isArray(res.content)) {
								let episodeLen = res.content.length;
								if (episodeLen) {
									let tempArray = res.content;
									tools.buy_episodes_list(that, playlet_id, (res) => {
										console.log(576,res)
										if (Array.isArray(res.content)) {
											if (res.content.length) {
												(res.content).sort((a, b) => a - b);
												that.buy_episodes_list = res.content;
												for (var i = 0; i < that.buy_episodes_list.length; i++) {
													if (typeof that.buy_episodes_list[i] == 'number') {
														tempArray[that.buy_episodes_list[i] - 1].pay_staus = 1;
													}
												}
											}
										}
										if(tempArray.length){
											that.eList = tempArray;
										}else{
											that.initEpisodesList = Date.now();
										}
									})
								}
							}
						}
					},
					fail: (err) => {
						this.loading = false;
					}
				})
			},
	
			async updateBuyList(playlet_id,all) {
			
				let that = this;
				console.log('===更新购买剧集===');
				that.loading = true;
				
				tools.buy_episodes_list(that, playlet_id, (res) => {
				
					if (Array.isArray(res.content)) {
						if (res.content.length) {
						
							(res.content).sort((a, b) => a - b);
							that.buy_episodes_list = res.content;
							let diyvideoList = that.videoList
							console.log(684,that.buy_episodes_list);
							for (var i = 0; i < that.buy_episodes_list.length; i++) {
								if (typeof that.buy_episodes_list[i] == 'number') {
									diyvideoList[that.buy_episodes_list[i] - 1].pay_staus = 1;
								}
							}
							that.videoList = diyvideoList
							console.log(680,that.videoList)
							this.initEpisodesList = Date.now();
							console.log(682,all)
							if(all){
								this.$refs.mvideo.allEpisodeinit();
							}
						}
					}
					if (JSON.stringify(that.userInfo) != "{}") {
						that.loading = false;
					} else {
						tools.get_user_info_by_serve(that, () => {
							that.loading = false;
						})
					}
				})
			},
			getTime(url) {
				// 使用正则表达式匹配t参数值
				let regex = /[?&]t=([^&]+)/,
					match = url.match(regex),
					timestamp;
				// 如果匹配成功，则将t参数值转换为时间戳
				if (match) {
					let tValue = match[1];
					timestamp = parseInt(tValue, 16) * 1000;
					// console.log(644,timestamp)
					return timestamp;
				} else {
					return '';
				}
			}
		}
	}
</script>
<style>
	/* #ifdef MP */
	page {
		background-color: #000000;
	}
	/* #endif */
	
</style>
<style lang="scss" scoped>
	.loadingMain {
		width: 220rpx;
		height: 200rpx;
	}
</style>